cd "G:\Dropbox (MIT)\Documents\Works\China Tax Compliance\Replication"
estimates clear
clear
set more off

use "TaxCompliance_Data_Conjoint.dta",clear

/* MAIN RESULTS, ONLINE CONJOINT */

/* Baseline result with choice */
# delimit cr
* SSI
reg selected i.citizen_input i.prov_supervise i.penalty_3 i.exemption if source == 0,cluster(respondentindex)
estimates store baseline_ssi_1

* Qualtrics
reg selected  i.citizen_input i.prov_supervise i.penalty_3 i.exemption if source == 1,cluster(respondentindex)
estimates store baseline_qualtrics_1

* Combine both datasets
reg selected  i.citizen_input i.prov_supervise i.penalty_3 i.exemption,cluster(respondentindex)
estimates store baseline_combine_1

/* Plot for baseline result with choice */
# delimit;
coefplot (baseline_ssi_1, label(SSI) msymbol(T) mcolor(red) ciopts(lc(red) lwidth(thin) lpattern(solid))) (baseline_qualtrics_1, label(Qualtrics) msymbol(S)  mcolor(orange)  ciopts(lc(orange) lwidth(thin) lpattern(solid))) (baseline_combine_1,label(Combined) msymbol(O)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))), 
	legend(pos(6))
	legend(row(1))
	coeflabels(, wrap(11))
		omitted base
		drop(_cons) 
		headings(0.penalty_3 = "{bf:Tax Payment Penalty}" 0.exemption = "{bf:Tax Exemption}" 0.citizen_input = "{bf:Citizen Input}"  0.prov_supervise = "{bf:Prov. Gov. Supervision}")
		xline(0) 	
		xlabel(-0.25(0.1)0.25)
		xtitle("Change in Pr(Property Tax Policy Selected)", size(small))
		ciopts(width(thin))
		xsize(11) ysize(9) scale(.9)
	graphregion(fcolor(white));
graph export fig_2.pdf,replace;
graph export fig_2.emf,replace;

/* APPENDICES, ONLINE CONJOINT */

/* Baseline result with ranking */
# delimit cr
* SSI
reg rank i.citizen_input i.prov_supervise i.penalty_3 i.exemption if source == 0,cluster(respondentindex)
estimates store baseline_ssi_2

* Qualtrics
reg rank  i.citizen_input i.prov_supervise i.penalty_3 i.exemption if source == 1,cluster(respondentindex)
estimates store baseline_qualtrics_2

* Combine both datasets
reg rank  i.citizen_input i.prov_supervise i.penalty_3 i.exemption,cluster(respondentindex)
estimates store baseline_combine_2

/* Plot for baseline result with ranking */
# delimit;
coefplot (baseline_ssi_2, label(SSI) msymbol(T) mcolor(red) ciopts(lc(red) lwidth(thin) lpattern(solid))) (baseline_qualtrics_2, label(Qualtrics) msymbol(S)  mcolor(orange)  ciopts(lc(orange) lwidth(thin) lpattern(solid))) (baseline_combine_2,label(Combined) msymbol(O)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))), 
	legend(pos(6))
	legend(row(1))
	coeflabels(, wrap(11))
		omitted base
		drop(_cons) 
		headings(0.penalty_3 = "{bf:Tax Payment Penalty}" 0.exemption = "{bf:Tax Exemption}" 0.citizen_input = "{bf:Citizen Input}"  0.prov_supervise = "{bf:Prov. Gov. Supervision}")
		xline(0) 	
		xlabel(-0.25(0.1)0.25)
		xtitle("Change in Tax Compliance", size(small))
		ciopts(width(thin))
		xsize(11) ysize(9) scale(.9)
	graphregion(fcolor(white));
graph export fig_b2.pdf,replace;
graph export fig_b2.emf,replace;

/* By property ownership */

/* Baseline result with choice */
# delimit cr
* 0 apt
reg selected i.citizen_input i.prov_supervise i.penalty_3 i.exemption if apartment_owned == 0,cluster(respondentindex)
estimates store baseline_apt_0

* 1 apt
reg selected  i.citizen_input i.prov_supervise i.penalty_3 i.exemption if apartment_owned == 1,cluster(respondentindex)
estimates store baseline_apt_1

* >1 apts
reg selected  i.citizen_input i.prov_supervise i.penalty_3 i.exemption if apartment_owned > 1,cluster(respondentindex)
estimates store baseline_apt_2plus

/* Plot for baseline result with choice */
# delimit;
coefplot (baseline_apt_0, label(Own No Apt.) msymbol(O) mcolor(black) ciopts(lc(black) lwidth(thin) lpattern(solid))) (baseline_apt_1, label(Own One Apt.) msymbol(S)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))) (baseline_apt_2plus,label(Own 2+ Apt) msymbol(D)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))), 
	legend(pos(6))
	legend(row(1))
	coeflabels(, wrap(11))
		omitted base
		drop(_cons) 
		headings(0.penalty_3 = "{bf:Tax Payment Penalty}" 0.exemption = "{bf:Tax Exemption}" 0.citizen_input = "{bf:Citizen Input}"  0.prov_supervise = "{bf:Prov. Gov. Supervision}")
		xline(0) 	
		xlabel(-0.25(0.1)0.25)
		xtitle("Change in Pr(Property Tax Policy Selected)", size(small))
		ciopts(width(thin))
		xsize(11) ysize(9) scale(.9)
	graphregion(fcolor(white));
graph export fig_b3.pdf,replace;
graph export fig_b3.emf,replace;

/* By location */

/* Baseline result with choice */
# delimit cr
* Shanghai & Chongqing
reg selected i.citizen_input i.prov_supervise i.penalty_3 i.exemption if inlist(location, "Shanghai", "Chongqing"), cluster(respondent)
estimates store baseline_SH_CQ

* Non-Shanghai & Chongqing
reg selected  i.citizen_input i.prov_supervise i.penalty_3 i.exemption if !inlist(location, "Shanghai", "Chongqing"), cluster(respondent)
estimates store baseline_non_SH_CQ

/* Plot for baseline result with choice */
# delimit;
coefplot (baseline_SH_CQ, label(Shanghai & Chongqing Resident) msymbol(O) mcolor(black) ciopts(lc(black) lwidth(thin) lpattern(solid))) (baseline_non_SH_CQ, label(Non Shanghai & Chongqing Resident) msymbol(Oh)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))), 
	legend(pos(6))
	legend(row(2))
	coeflabels(, wrap(11))
		omitted base
		drop(_cons) 
		headings(0.penalty_3 = "{bf:Tax Payment Penalty}" 0.exemption = "{bf:Tax Exemption}" 0.citizen_input = "{bf:Citizen Input}"  0.prov_supervise = "{bf:Prov. Gov. Supervision}")
		xline(0) 	
		xlabel(-0.25(0.1)0.25)
		xtitle("Change in Pr(Property Tax Policy Selected)", size(small))
		ciopts(width(thin))
		xsize(11) ysize(9) scale(.9)
	graphregion(fcolor(white));
graph export fig_b4.pdf,replace;
graph export fig_b4.emf,replace;


/* APPENDICES, LAB-IN-THE-FIELD CONJOINT */
# delimit cr
use "TaxCompliance_Data_Lab_Conjoint.dta",clear

/* Lab in the field result with choice */
# delimit cr
reg selected i.citizen_suggestion i.prov_supervise i.exemption i.rate i.penalty_3 i.pub_good, cluster(respondent)
estimates store baseline_lab_1

/* Plot for lab in the field result with choice */
# delimit;
coefplot (baseline_lab_1,label(Baseline) msymbol(O)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))) , 
	legend(pos(6))
	legend(row(1))
	coeflabel(, wrap(20))
		omitted base
		drop(_cons) 
		headings(0.prov_supervise = "{bf:Prov. Gov. Supervision}" 0.citizen_suggestion = "{bf:Citizen Input}" 0.exemption = "{bf:Exemption Threshold}" 0.rate = "{bf:Tax Rate}" 0.penalty_3 = "{bf:Tax Payment Penalty}"  0.pub_good = "{bf:Spd. on Public Goods}")
		xline(0) 	
		xlabel(-0.25(0.1)0.25)
		xtitle("Change in Pr(Property Tax Policy Selected)", size(small))
		ciopts(width(thin))
		legend(off)
		xsize(11) ysize(9) scale(.9)
	graphregion(fcolor(white));
graph export fig_c6.pdf,replace;
graph export fig_c6.emf,replace;

/* Lab in the field result with ranking */
# delimit cr
reg rank i.citizen_suggestion i.prov_supervise i.exemption i.rate i.penalty_3 i.pub_good, cluster(respondent)
estimates store baseline_lab_2

/* Plot for lab in the field result with ranking */
# delimit;
coefplot (baseline_lab_2,label(Baseline) msymbol(O)  mcolor(black)  ciopts(lc(black) lwidth(thin) lpattern(solid))) , 
	legend(pos(6))
	legend(row(1))
	coeflabel(, wrap(20))
		omitted base
		drop(_cons) 
		headings(0.prov_supervise = "{bf:Prov. Gov. Supervision}" 0.citizen_suggestion = "{bf:Citizen Input}" 0.exemption = "{bf:Exemption Threshold}" 0.rate = "{bf:Tax Rate}" 0.penalty_3 = "{bf:Tax Payment Penalty}"  0.pub_good = "{bf:Spd. on Public Goods}")
		xline(0) 	
		xlabel(-0.5(0.1)0.5)
		xtitle("Change in Tax Compliance", size(small))
		ciopts(width(thin))
		legend(off)
		xsize(11) ysize(9) scale(.9)
	graphregion(fcolor(white));
graph export fig_c7.pdf,replace;
graph export fig_c7.emf,replace;